#ifndef UTILS_H
#define UTILS_H

#include <cstdint>
#include <string>

typedef enum
{
	TYPE_YUV422I_UYVY,
	TYPE_YUV422I_YUYV,
	TYPE_YUV420SP_NV12,
	TYPE_YUV420SP_NV21,
	TYPE_YUV422P,
	TYPE_YUV444I,
	TYPE_YUV444P,
}enYuvType;
 
typedef enum
{
	YUV_GREEN,
	YUV_RED,
	YUV_BLUE,
	YUV_PURPLE,
	YUV_DARK_GREEN,
	YUV_YELLOW,
	YUV_LIGHT_BLUE,
	YUV_LIGHT_PURPLE,
	YUV_DARK_BLACK,
	YUV_GRAY,
	YUV_WHITE,
	YUV_COLOR_MAX,
}enYuvColorIdx;
 
typedef struct
{
	uint8_t Y;
	uint8_t U;
	uint8_t V;
}stYuvColor;
 
typedef struct
{
	uint16_t x;
	uint16_t y;
}stPoint;
 
typedef struct
{
	stPoint startPoint;
	stPoint endPoint;
	uint16_t lineWidth;
	enYuvColorIdx clrIdx;
}stDrawLineInfo;
 
typedef struct
{
	enYuvType yuvType;
	uint8_t *pYuvBuff;
	uint16_t width;
	uint16_t height;
}stYuvBuffInfo;
 


class Utils {
public:
    Utils() {};
    ~Utils() {};
    static void YuvDrawRect(stYuvBuffInfo* yuvBuffInfo, stPoint &startPoint, stPoint &endPoint, enYuvColorIdx clrIdx, int16_t lineSolid);
    static void YuvDrawText(stYuvBuffInfo* yuvBuffInfo, stPoint &point, const std::string &text, const enYuvColorIdx clrIdx);

    static void YuvSetData(uint8_t* YBuff, uint8_t* UVBuff, uint16_t width, uint16_t height,
                    enYuvType yuvType, stPoint draw_point, enYuvColorIdx clrIdx);
	static void YuvSetYData(uint8_t* YBuff, uint8_t* UVBuff, uint16_t width, uint16_t height,
                    enYuvType yuvType, stPoint draw_point, enYuvColorIdx clrIdx);
    static void YuvDrawLine(stYuvBuffInfo *pYuvBuffInfo, stDrawLineInfo *pDrawLineInfo);

};

class RunStatus {
public:
    static void SetDeviceStatus(bool isDevice)
    {
        isDevice_ = isDevice;
    }
    static bool GetDeviceStatus()
    {
        return isDevice_;
    }

	static uint32_t GetVencChannel() 
	{ 
		return vencChannel_ ;
	}

	static void SetVencChannel(uint32_t ch) 
	{ 
		vencChannel_= ch;
	}
	
private:
    RunStatus() = default;
    ~RunStatus() = default;
    static bool isDevice_;
	static uint32_t vencChannel_;
};

#endif
